<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>魏远商城</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="shortcut icon" href="/favicon.ico">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		
		<link rel="stylesheet" href="css/my-order.css" />
		<link rel="stylesheet" href="css/style.css" />
	</head>
		
	<body style="background: #eaeef1;">
		<header class="bar bar-nav return-header" style="width: 100%;">
			<span class="order-back mui-action-back"><img src="img/back-le.png" height="50%"/></span>
			<h1 class="title"style="line-height: 2.2rem;">我的优惠券</h1>
		</header>
		<div class="mui-content" style="padding-top: 2.2rem;">
			<div class="my-coupon-content my-coupon-content1">
				<img class="imga" src="img/my-coupon.jpg" width="100%"/>	
				<span >原味</span>
				<span>￥23</span>
				<span>2017-2016</span>
				<span>代金券/满减卷</span>		
			</div>	
			<div class="my-coupon-content my-coupon-content1 color-chang">
				<img class="imga" src="img/my-coupon-guoqi.png" width="100%"/>	
				<span >原味</span>
				<span>￥23</span>
				<span>2017-2016</span>
				<span>代金券/满减卷</span>		
			</div>	
			<div  class="my-coupon-content my-coupon-content1 color-chang">
				<img class="imga" src="img/my-coupon-shiyong.png" width="100%"/>	
				<span>原味</span>
				<span>￥23</span>
				<span>2017-2016</span>
				<span>代金券/满减卷</span>		
			</div>
		</div>
			
	</div>	
		<script src="js/jquery-3.1.1.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/url.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
		var token =localStorage.token;
			coupon();
			function coupon() {
				console.log('开始调用接口')
				$.ajax({
					url:ur+'mobilemember/frontmember/getMemberCoupon',
					type: 'post',
					dataType: 'json',
					headers: {
						'X-Token': token
					},
					data: '',
					success: function(data) {
						console.log(JSON.stringify(data))
						console.log(JSON.stringify(data.result.data) + '>>>>获取资料接口');
						var n = data.result.data.length;
						
						console.log(JSON.stringify(n));
						console.log(JSON.stringify(data.result.data[0].ocName));
						console.log(JSON.stringify(data.result.data[0].ocReduceAmount));
						console.log(JSON.stringify(data.result.data[0].shopsname));
						for(i = 0; i < n; i++) {
							var dateBeginStr = data.result.data[i].ocCreateTime.substring(0,10);
							var dateEndStr = data.result.data[i].ocExpired.substring(0,10);
							var product = $('<div class="my-coupon-content">'+
							'<img class="imga" src="img/my-coupon.jpg" width="100%"/>'+
							'<span >'+data.result.data[i].shopsname+'</span>'+
							'<span >'+'￥'+data.result.data[i].ocReduceAmount+'</span>'+
							'<span >'+dateBeginStr+' — '+dateEndStr+'</span>'+
							'<span >'+data.result.data[i].ocName+'</span>'+
							'</div>'
							);
								$('.mui-content').append(product);
						}
						$('.mui-content').on('tap','.imga',function(){
							alert(111);
							$(this).attr('src','img/my-coupon1.jpg');
						})
					},
					error: function(e) {
						console.log(e+'>><<错误优惠卷')
					}
				})
			}
		</script>
	</body>

</html>